/*
File Header

*/
#pragma once

#include <list>
#include <map>

using std::multimap;
using std::pair;
using std::list;

#include "Event.h"
#include "IListener.h"

#pragma once

class CEventSystem
{
private:

	multimap<EVENTID, IListener*>	m_TheClients;

	list<CEvent>		m_CurrentEvents;

	void DispatchEvent(CEvent* pEvent);
	bool AlreadyRegistered(EVENTID eventID, IListener* pClient);

	CEventSystem(void) {/*Do Nothing*/};
	~CEventSystem(void) {/*Do Nothing*/};
	CEventSystem(const CEventSystem&);
	CEventSystem& operator=(const CEventSystem&);

public:

	static CEventSystem* GetInstance(void);

	void ClientResignation(EVENTID eventID, IListener* pClient);

	void ClientUnresignation(EVENTID eventID, IListener* pClient);

	void UnregisterAll(IListener* pClient);

	bool HasEventTriggered( EVENTID eventID );

	void SendEvent(EVENTID eventID, void* pData = NULL);

	void SendUniqueEvent( EVENTID eventID, void* pData = NULL );

	void ProcessEvents(void);

	void ClearEvents(void);

	void ShutdownCEventSystem(void);
};

